﻿
Partial Class MasterPageDetails
    Inherits System.Web.UI.MasterPage
    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        If Session("IDCity") IsNot Nothing AndAlso Not Session("IDCity").Equals("") Then

            If Not IsPostBack Then
                'DetailKhachSan.aspx?IDKS={0}
                Dim khachSan As KhachSan = Nothing
                If Request.QueryString("IDKS") IsNot Nothing Then
                    Dim idKS As New Guid(Request.QueryString("IDKS"))
                    khachSan = KhachSanServer.GetKhachSanByIDKhachSan(idKS)
                    ' Dim strCity As String = KhachSanServer.GetCityNameByIDCity(khachSan.CITY_ID)
                    divHeader.InnerHtml = ""
                    Dim urlImage As String = String.Format("http://www.khachsan24gio.vn{0}", khachSan.IMG_URL)
                    Dim strStart As String = String.Format("{1}/Images/star-yellow-{0}-0.png", khachSan.STARS, Util.GetConfigKey("RootURl"))
                    Dim strHTML As String = "<h2 class='header'>"
                    strHTML = String.Format("{0}  <a class='ui-link' href='javascript:void(0);'> {1}</a></h2><p>", strHTML, khachSan.NAME)
                    strHTML = String.Format("{0} <a class='ui-link' href='javascript:void(0);'> ", strHTML)
                    strHTML = String.Format("{0} <img align='right' alt='' src='{1}' style='width :80px; height :80px;'>", strHTML, urlImage)
                    strHTML = String.Format("{0} </a><img style='padding-bottom:10px;' src='{1}'>", strHTML, strStart)
                    strHTML = String.Format("{0} <br>{1}, {2}<br> ", strHTML, khachSan.ADDRESS_1, Session("NameCity"))
                    Dim arrDichVu As ArrayList = KhachSanServer.GetDichVuByIDKhachSan(idKS)
                    strHTML = String.Format("{0} </p><ul>", strHTML)
                    Dim arrDichVuDacBiet() As String = Split(Util.GetConfigKey("DichVuDacBiet", "Wifi / Internet miễn phí ở khu vực công cộng[$]Dịch vụ hội họp[$]Đưa đón sân bay[$]Giải trí - ẩm thực[$]Massage[$]Bar"), "[$]")
                    For i As Integer = 0 To arrDichVu.Count - 1
                        For j As Integer = 0 To arrDichVuDacBiet.Length - 1
                            If arrDichVu(i).Equals(arrDichVuDacBiet(j)) Then
                                strHTML = String.Format("{0} <li> {1}</li>", strHTML, arrDichVu(i))
                            End If
                        Next
                        '' strHTML = String.Format("{0} <li> {1}</li>", strHTML, arrDichVu(i))
                    Next
                    'strHTML = String.Format("{0} ", strHTML)
                    strHTML = String.Format("{0} </ul> ", strHTML)
                    divHeader.InnerHtml = strHTML
                    If Me.Page.Page.ToString() = "ASP.getprice_aspx" Then
                        divHeader.InnerHtml = ""
                    End If
                    Dim strCity As String = ""
                    If Session("NameCity") IsNot Nothing AndAlso Not Session("NameCity").Equals("") Then
                        strCity = Session("NameCity")
                    Else
                        strCity = KhachSanServer.GetCityNameByIDCity(khachSan.CITY_ID)
                    End If                 
                    divNameHotelTile.InnerHtml = strCity
                End If
            End If
        Else
            Response.Redirect("{1}/trang-chu.html", Util.GetConfigKey("RootURl"))
        End If
    End Sub
End Class

